#include "Shm.hpp"
#include "namedpipe.hpp"

int main()
{
    //引入管道之后就可以使用管道才有的四种状态了
    Shm shm(gpathname, gproj_id, gUser);
    shm.zero();
    char* shmaddr = (char*)shm.addr();
    sleep(3);

    NamedPipe fifo(common_path, User);
    fifo.openForWrite();
    char ch = 'A';
    while (ch <= 'Z')
    {

        shmaddr[ch-'A'] = ch;
        ch++;
        std::string tmp = "wakeup";
        std::cout << "add " << ch << " into Shm, " << "wakeup reader" << std::endl;
        fifo.writeNamedPipe(tmp);
        sleep(2); 
    }
    
    // sleep(5);

    // char *addr = (char *)shm.attachShm();
    return 0;
}
